package org.linlinjava.litemall.wx.web;

import org.linlinjava.litemall.core.util.ResponseUtil;
import org.linlinjava.litemall.db.dao.LitemallUserMapper;
import org.linlinjava.litemall.db.domain.DevicesRecord;
import org.linlinjava.litemall.db.service.DevicesRecordService;
import org.linlinjava.litemall.db.service.LitemallUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/wx/records")
public class DevicesRecordController {

    @Autowired
    private DevicesRecordService recordService;

    @GetMapping("/{id}")
    public Object getById(@PathVariable Integer id) {
        return ResponseUtil.ok(recordService.getById(id));
    }

    @PostMapping("/create")
    public Object create(@RequestBody DevicesRecord record) {
        return ResponseUtil.ok(recordService.save(record));
    }


    @PostMapping("/completeRecord")
    public Object completeRecord(@RequestBody DevicesRecord record) {
        return ResponseUtil.ok(recordService.completeRecord(record.getId()));
    }




    @PostMapping("/failRecord")
    public Object failRecord(@RequestBody DevicesRecord record) {
        return ResponseUtil.ok(recordService.failRecord(record.getId()));
    }
}